      SUBROUTINE TAVISPAK2(ELEMS,ORBDATA)
      IMPLICIT REAL*8 (A-H,O-Z)
C
C THIS ROUTINE IS PART OF TOSS'S TAVISPAK SET OF SUBROUTINES.  IT
C COMPUTES MISCELLANEOUS ORBIT-RELATED PARAMETERS NEEDED WITHIN THE
C AVAILABILITY ALGORITHMS.
C
C***********************************************************************
C
C BY C PETRUZZ0, GSFC/742,  1/86.
C        MODIFIED....
C
C***********************************************************************
C
      REAL*8 P(3),Q(3),ORBDATA(20)
      REAL*8 ELEMS(5),ORBNORM(3)
      REAL*8 DEGRAD / 57.29577951308232D0 /
C
C COMPUTE VALUES FOR THE ORBDATA ARRAY.  THE P AND Q ARRAYS CONVERT A
C POSITION OR VELOCITY VECTOR FROM ORBIT PLANE COORDINATES TO THE
C COORDINATE SYSTEM IN WHICH ELEMS IS EXPRESSED.
C
      ERTHMU = CONST(56)
C
      COSINCL = DCOS(ELEMS(3))
      SININCL = DSIN(ELEMS(3))
      COSNODE = DCOS(ELEMS(4))
      SINNODE = DSIN(ELEMS(4))
      COSARGP = DCOS(ELEMS(5))
      SINARGP = DSIN(ELEMS(5))
C
      P(1) =  COSARGP*COSNODE - SINARGP*SINNODE*COSINCL
      P(2) =  COSARGP*SINNODE + SINARGP*COSNODE*COSINCL
      P(3) =  SINARGP*SININCL
C
      Q(1) = -SINARGP*COSNODE - COSARGP*SINNODE*COSINCL
      Q(2) = -SINARGP*SINNODE + COSARGP*COSNODE*COSINCL
      Q(3) =  COSARGP*SININCL
C
      ORBNORM(1) =  SININCL*SINNODE
      ORBNORM(2) = -SININCL*COSNODE
      ORBNORM(3) =  COSINCL
C
      ORBDATA( 1) = ELEMS(1)
      ORBDATA( 2) = ELEMS(2)
      ORBDATA( 3) = P(1)
      ORBDATA( 4) = P(2)
      ORBDATA( 5) = P(3)
      ORBDATA( 6) = Q(1)
      ORBDATA( 7) = Q(2)
      ORBDATA( 8) = Q(3)
      ORBDATA( 9) = DSQRT(ERTHMU/ELEMS(1))
      ORBDATA(10) = DSQRT(1.D0-ELEMS(2)**2)
      ORBDATA(11) = ELEMS(1)*ORBDATA(10)
      ORBDATA(12) = COSINCL
      ORBDATA(13) = SININCL
      ORBDATA(14) = COSNODE
      ORBDATA(15) = SINNODE
      ORBDATA(16) = COSARGP
      ORBDATA(17) = SINARGP
      ORBDATA(18) = ORBNORM(1)
      ORBDATA(19) = ORBNORM(2)
      ORBDATA(20) = ORBNORM(3)
C
      RETURN
      END
